<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Document</title>
</head>
<body>

  <div id='app'>
    {{ num }}
    {{ num2 }}
    <button @click="change">点击改变计算属性</button>
  </div>

<script src='https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js'></script>
<script>
  const app = new Vue({
    el: '#app'
    ,data: {
      num: 10
    }
    ,methods: {
      change() {
        this.num2 = 100
      }
    }
    ,computed: {
      // num2() {
      //   return this.num * 2
      // }
      num2: {
        get(){
          return this.num * 2
        }
        ,set(val){
          console.log('set调用', val);
          this.num = val / 2
        }
      }
    }
  })
</script>
</body>
</html>